<template>
    <div class="roleHasUser">
        <table-index
            :dataSource="dataSource"
            :tableColumns="tableColumns"
            :btnList="btnList"
            :pageSize="pageSize"
            :pageCount="pageCount"
            :pageNo="pageNo"
            selection
            @pageChange="pageChange"
        ></table-index>
        <div class="btn">
            <el-button type="primary" @click="onSubmit">确定</el-button>
            <el-button @click="cancel">取消</el-button>
        </div>
    </div>
</template>

<script>
import tableIndex from "@/components/customComponents/customeTable/tableIndex"
import {Utility} from "@/libs/utility"
import {userList} from "@/mockData/systemManage.js"
export default {
    props: ["roleId"],
    components: {
        tableIndex
    },
    data() {
        return {
            selectDeviceList: [],
            userName: "",
            roleName: "",
            device_type: "",
            device_typeList: Utility.getDictList("device_type"),
            status: "",
            statusList: Utility.getDictList("status"),
            // table 相关参数  begin
            dataSource: userList,
            tableColumns: [
                {
                    prop: "name",
                    label: "姓名"
                },
                {
                    prop: "loginName",
                    label: "登录名"
                },
                {
                    prop: "sex",
                    label: "性别",
                    dictName: "sex"
                },
                {
                    prop: "tel",
                    label: "联系电话"
                },
                {
                    prop: "email",
                    label: "邮箱"
                },
                {
                    prop: "address",
                    label: "地址"
                },
                {
                    prop: "isNormal",
                    label: "是否启用",
                    dictName: "trueOrFalse"
                },
                {
                    prop: "lastLoginTime",
                    label: "最后登录时间"
                },
                {
                    prop: "lastLoginPerson",
                    label: "最后操作人"
                },
                {
                    prop: "lastOprTime",
                    label: "最后操作时间"
                },
                {
                    prop: "roleName",
                    label: "所属角色"
                }
            ],
            btnList: [],
            pageSize: 20,
            pageCount: 2,
            pageNo: 1
            // table 相关参数  end
        }
    },
    methods: {
        cancel() {
            this.$emit("close", "")
        },
        onSubmit() {
            this.$emit("close", "")
        },
        pageChange(p) {
            this.pageNo = p
            this.initPage()
        },
        initPage() {
            //   let self = this;
            //   AjaxCommon("/ccdc/cfg/device/device/listByPage", "post", {
            //     userName: this.userName,
            //     deviceStatus: this.status,
            //     deviceType: this.device_type,
            //     pageNo: this.pageNo,
            //     pageSize: this.pageSize,
            //   }).then((res) => {
            //     if (res.data.code == 200) {
            //       self.dataSource = res.data.result.records;
            //       self.pageCount = res.data.result.total;
            //     } else {
            //       PopupCommon.notify("error", res.data.message);
            //     }
            //   });
        }
    },
    mounted() {
        this.initPage()
    }
}
</script>

<style>
.roleHasUser {
    .mcTableIndex {
        height: 400px;
    }
    .btn {
        border-top: 1px solid #e0e0e0;
        text-align: right;
        margin-top: 20px;
        padding-top: 10px;
    }
}
</style>
